package com.dkd.sbtz.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.dkd.common.annotation.Log;
import com.dkd.common.core.controller.BaseController;
import com.dkd.common.core.domain.AjaxResult;
import com.dkd.common.enums.BusinessType;
import com.dkd.sbtz.domain.AssetNodeTestOne;
import com.dkd.sbtz.service.IAssetNodeTestOneService;
import com.dkd.common.utils.poi.ExcelUtil;

/**
 * 设备台账测试Controller
 * 
 * @author xzj
 * @date 2025-10-16
 */
@RestController
@RequestMapping("/sbtz/nodetestone")
public class AssetNodeTestOneController extends BaseController
{
    @Autowired
    private IAssetNodeTestOneService assetNodeTestOneService;

    /**
     * 查询设备台账测试列表
     */
    @PreAuthorize("@ss.hasPermi('sbtz:nodetestone:list')")
    @GetMapping("/list")
    public AjaxResult list(AssetNodeTestOne assetNodeTestOne)
    {
        List<AssetNodeTestOne> list = assetNodeTestOneService.selectAssetNodeTestOneList(assetNodeTestOne);
        return success(list);
    }

    /**
     * 导出设备台账测试列表
     */
    @PreAuthorize("@ss.hasPermi('sbtz:nodetestone:export')")
    @Log(title = "设备台账测试", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, AssetNodeTestOne assetNodeTestOne)
    {
        List<AssetNodeTestOne> list = assetNodeTestOneService.selectAssetNodeTestOneList(assetNodeTestOne);
        ExcelUtil<AssetNodeTestOne> util = new ExcelUtil<AssetNodeTestOne>(AssetNodeTestOne.class);
        util.exportExcel(response, list, "设备台账测试数据");
    }

    /**
     * 获取设备台账测试详细信息
     */
    @PreAuthorize("@ss.hasPermi('sbtz:nodetestone:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(assetNodeTestOneService.selectAssetNodeTestOneById(id));
    }

    /**
     * 新增设备台账测试
     */
    @PreAuthorize("@ss.hasPermi('sbtz:nodetestone:add')")
    @Log(title = "设备台账测试", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody AssetNodeTestOne assetNodeTestOne)
    {
        return toAjax(assetNodeTestOneService.insertAssetNodeTestOne(assetNodeTestOne));
    }

    /**
     * 修改设备台账测试
     */
    @PreAuthorize("@ss.hasPermi('sbtz:nodetestone:edit')")
    @Log(title = "设备台账测试", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody AssetNodeTestOne assetNodeTestOne)
    {
        return toAjax(assetNodeTestOneService.updateAssetNodeTestOne(assetNodeTestOne));
    }

    /**
     * 删除设备台账测试
     */
    @PreAuthorize("@ss.hasPermi('sbtz:nodetestone:remove')")
    @Log(title = "设备台账测试", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(assetNodeTestOneService.deleteAssetNodeTestOneByIds(ids));
    }
}
